package book;

public class BookList {

    //目前只能放10本书

    private int intCapacity = 3; //初始容量
    private Book[] books = new Book[3];
    private int useSize; //记录当前book数组里有几本书

    public BookList() {
        books[0] = new Book("三国演义","罗贯中",19,"小说");
        books[1] = new Book("西游记","吴承恩",39,"小说");
        books[2] = new Book("红楼梦","曹雪芹",29,"小说");
        this.useSize = 3;
    }

    //pos位置合法!!
    public Book getBook(int pos) {
        return books[pos];
    }

    //pos位置合法!!
    //book是需要添加的书
    public void setBook(int pos, Book book) {
        books[pos] = book;
    }

    /**
     * 实时获取当前的书的个数
     * @return 书的个数
     */
    public int getUseSize() {
        return this.useSize;
    }

    /**
     * 实时修改书架上的书的个数
     */
    public void setUseSize(int size) {
        this.useSize = size;
    }

    public Book[] getBooks() {
        return books;
    }

    public void setBooks(Book[] books) {
        this.books = books;
    }

    public  int getIntCapacity() {
        return intCapacity;
    }

    public void setIntCapacity(int intCapacity) {
        this.intCapacity = intCapacity;
    }
}
